package controller

import (
	"github.com/gin-gonic/gin"
)

var Router router

//声明一个router结构体
type router struct {
	
}

//初始化路由规则
func (r *router)InitApiRouter(router *gin.Engine)  {

	router.
		//获取pod信息列表
		GET("/api/k8s/pods",Pod.GetPods).
		//获取单个pod详情
		GET("/api/k8s/pod/detail",Pod.GetPodDetail).
		//删除pod
		DELETE("/api/k8s/pod/delete",Pod.DeletePod).
		//获取pod日志
		GET("/api/k8s/pod/logs",Pod.GetPodLog).
		//更新pod
		PUT("/api/k8s/pod/update",Pod.UpdatePod).
		//获取每个namespace中pod数
		GET("/api/k8s/podnum",Pod.GetPodNum).
		//获取pod中的容器名
		GET("/api/k8s/pod/container",Pod.GetPodContainer).

		//获取deployment信息列表
		GET("/api/k8s/deployments",Deployment.Getdeployments).
		//获取单个deployment
		GET("/api/k8s/deploy/detail",Deployment.GetDeployDetail).
		//更改deployment副本数
		PUT("/api/k8s/deploy/scale",Deployment.UpdateDeployScale).
		//创建deployment
		POST("/api/k8s/deploy/create",Deployment.CreateDeployment).
		//删除deployment
		DELETE("/api/k8s/deploy/delete",Deployment.DeleteDeployment).
		//重启deployment
		PUT("/api/k8s/deploy/restart",Deployment.RestartDeployment).
		//获取每个命名空间中deploy数量
		GET("/api/k8s/deploynum",Deployment.GetDeployNum).
		//更新deploy
		PUT("/api/k8s/deploy/update",Deployment.UpdateDeply).

		//获取daemonset列表
		GET("/api/k8s/daemonsets",Daemonset.Getdaemonsets).
		GET("/api/k8s/daemonset/detail",Daemonset.GetDaemonDetail).
		DELETE("/api/k8s/daemonset/delete",Daemonset.DelDaemonset).

		//获取 statefulset 列表
		GET("/api/k8s/statefulsets",Statefulset.GetStatefuls).
		GET("/api/k8s/statefulset/detail",Statefulset.GetStatefulDetail).
		DELETE("/api/k8s/statefulset/delete",Statefulset.DelStatefulset).

		//创建service
		POST("/api/k8s/service/create",Service.CreateService).
		//删除service
		DELETE("/api/k8s/service/delete",Service.DeleteService).
		GET("/api/k8s/services",Service.GetServices).
		GET("/api/k8s/service/detail",Service.GetServiceDetail).

		//获取node列表
		GET("/api/k8s/nodes",Node.GetNodes).
		GET("/api/k8s/node/detail",Node.GetNodeDetail).

		//获取namespace
		GET("/api/k8s/namespaces",Namespace.GetNamespace).
		///api/k8s/namespace/detail?name_space=default
		GET("/api/k8s/namespace/detail",Namespace.GetNSDetail).
		POST("/api/k8s/namespace/create",Namespace.CreateNamespace).
		DELETE("/api/k8s/namespace/delete",Namespace.DeleteNamespace).

		//获取pv
		GET("/api/k8s/pvs",PersistentVolume.Getpersistentvolume).
		GET("/api/k8s/pv/detail",PersistentVolume.GetNSDetail).
		DELETE("/api/k8s/pv/delete",PersistentVolume.DeletePV)


}